import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ApiResponse } from '../interfaces/api.response';
import { LoginDto } from '../interfaces/login-dto';

@Injectable({ providedIn: 'root' })
export class LoginApi {
    constructor(private http: HttpClient) {

    }

    /**
     * 获得登录医院信息
     * @returns 
     */
    getLoginHosp(tenantId: string = '0001'): Observable<ApiResponse> {
        let url = `/api/a0/sys/hrp-sys-hospital/public/loginHosp?tenantId=${tenantId}`
        return this.http.get<ApiResponse>(url, {});
    }

    /**
     * 登录
     * @returns 
     */
    postLogin(data: LoginDto): Observable<ApiResponse> {
        let url = `/api/a0/login/hrp-sys-auth/login`
        return this.http.post<ApiResponse>(url, {
            ...data
        });
    }

}